package com.jqr.activity.recyclerviewdemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.util.Log;

import com.jqr.activity.recyclerviewdemo.adapters.MyAdapter;
import com.jqr.activity.recyclerviewdemo.model.News;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private RecyclerView recyclerView;

    private List<String> stringList;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        recyclerView=findViewById(R.id.rvContainer);

        initData();

        initEvent();
    }

    private void initData(){
       stringList =new  ArrayList<>();

       stringList.add("Java");
       stringList.add("Python");
       stringList.add("Scale");
       stringList.add("Vue3");
       stringList.add("TypeScript");


    }
   private void initEvent(){
       Log.d("TAG",String.valueOf(stringList.size()));
       MyAdapter myAdapter=new MyAdapter(this,stringList);
       recyclerView.setAdapter(myAdapter);
       RecyclerView.LayoutManager layoutManager=new LinearLayoutManager(this);
       recyclerView.setLayoutManager(layoutManager);

    }


}